#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const int N=2e5+10;
#define INF 0x3f3f3f3f;
typedef long long int ll;
#define close(); std::ios::sync_with_stdio(false);cin.tie(0),cout.tie(0);
//----------------------------------------------------------------------------//
int n;
int g[N];
void solve()
{
	cin>>n;
	for(int i=1;i<=n;i++) cin>>g[i];

	if(g[1]==1)//1为1直接从n+1-1-2--------n
	{
		cout<<n+1<<" ";
		for(int i=1;i<=n;i++) cout<<i<<" ";
		cout<<'\n';
		return;
	}
	if(g[n]==0) //直接一条路走下去
	{
		for(int i=1;i<=n+1;i++) cout<<i<<" ";
		cout<<'\n';
		return;
	}

	for(int i=1;i<=n-1;i++)
	{
		if(g[i]==0&&g[i+1]==1)//0过去,1回来
		{
			for(int j=1;j<=i;j++) cout<<j<<" ";
			cout<<n+1<<" ";
			for(int j=i+1;j<=n;j++) cout<<j<<" ";
			cout<<'\n';
			return;
		}
	}
	cout<<-1<<'\n';

	
}

int main()
{
	close();
	int T; cin>>T;
	while (T--) solve();
	return 0;
}
//一共有n+1个节点 1-2-3-4-...-n的单向图,[1,n]这些点到n+1都有一条路,方向题目给
//问题是要不重复的遍历这n+1个点,如果不存在输出-1

